<%@ attribute name="caption" required="true"%>
<%@ taglib tagdir="/WEB-INF/tags/connect" prefix="connect"%>
<%@ taglib tagdir="/WEB-INF/tags/templates/parts" prefix="prts"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/lang" prefix="lang"%>

<div class='header'>
	<img src='images/logo.png' class='header-logo' />
	<div class="header-back"></div>
	<div class="header-front">
		<div class='header-lang'>
			<a href='javascript:CreateCookie("lang", "rus", 2);document.location.href="index"'>
				<span id="${requestScope.currentLang eq 'rus' ? 'active' : ''}">rus</span>
			</a><a href='javascript:CreateCookie("lang", "eng", 2);document.location.href="index"'>
				<span id="${requestScope.currentLang eq 'eng' ? 'active' : ''}">eng</span>
			</a>
		</div>
		<h1>
			<jsp:doBody />
		</h1>
		<c:out value="${caption}" />
	</div>
	<div class="header-nav">
		<ul>
			<c:choose>
				<c:when test="${requestScope.logined}">
					<prts:header.item reactor="/index" linkuri="index" >
						<lang:out key="home" def="Главная" />
					</prts:header.item>
					<prts:header.item reactor="/hello" linkuri="hello" >
						<lang:out key="hello" def="Привет" />
					</prts:header.item>
					<connect:display rules="admin,user_view,view">
						<prts:header.item reactor="/user" linkuri="user_view" >
							<lang:out key="users" def="Пользователи" />
						</prts:header.item>
					</connect:display>
					<connect:display rules="admin,object_view,view,objecter">
						<prts:header.item reactor="/object" linkuri="object_view" >
							<lang:out key="objects" def="Объекты" />
						</prts:header.item>
					</connect:display>
					<connect:display rules="admin,task_view,view,tasker">
						<prts:header.item reactor="/task" linkuri="task_view" >
							<lang:out key="tasks" def="Задания" />
						</prts:header.item>
					</connect:display>
					<connect:display rules="admin,team_view,view,kadrovik,brigadir">
						<prts:header.item reactor="/team" linkuri="team_view" >
							<lang:out key="teams" def="Бригады" />
						</prts:header.item>
					</connect:display>
					<connect:display rules="admin,worker_view,view,kadrovik,brigadir">
						<prts:header.item reactor="/worker" linkuri="worker_view" >
							<lang:out key="workers" def="Рабочие" />
						</prts:header.item>
					</connect:display>
					<form method='POST' action='login'
						style='position: absolute; top: 2px; right: 170px;'>
						<input name='logout' value='<lang:out key="quit" def="выход"></lang:out>' type='submit'\>
					</form>
				</c:when>
				<c:otherwise>
					<prts:header.item reactor="/login" linkuri="login" >
						<lang:out key="enter" def="Вход в систему" />
					</prts:header.item>
				</c:otherwise>
			</c:choose>
		</ul>
	</div>
</div>
